<html><head><title>ToolBar.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - ToolBar example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#3A3966">UsePNGImageDecoder</font>()

<b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 100, 200, 195, 260, &quot;ToolBar example&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_SizeGadget</font>)

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateToolBar</font>(0,<font color="#3A3966"> WindowID</font>(0))
<font color="#3A3966">    ToolBarImageButton</font>(0,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/New.png&quot;))
<font color="#3A3966">    ToolBarImageButton</font>(1,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Open.png&quot;))
<font color="#3A3966">    ToolBarImageButton</font>(2,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Save.png&quot;))
    
<font color="#3A3966">    ToolBarSeparator</font>()

<font color="#3A3966">    ToolBarImageButton</font>(3,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Cut.png&quot;))
<font color="#3A3966">    ToolBarToolTip</font>(0, 3, &quot;Cut&quot;)
    
<font color="#3A3966">    ToolBarImageButton</font>(4,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Copy.png&quot;))
<font color="#3A3966">    ToolBarToolTip</font>(0, 4, &quot;Copy&quot;)
    
<font color="#3A3966">    ToolBarImageButton</font>(5,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Paste.png&quot;))
<font color="#3A3966">    ToolBarToolTip</font>(0, 5, &quot;Paste&quot;)
    
<font color="#3A3966">    ToolBarSeparator</font>()

<font color="#3A3966">    ToolBarImageButton</font>(6,<font color="#3A3966"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/ToolBar/Find.png&quot;))
<font color="#3A3966">    ToolBarToolTip</font>(0, 6, &quot;Find a document&quot;)
  <b><font color="#3A3966">EndIf</font></b>


  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))
<font color="#3A3966">    MenuTitle</font>(&quot;Project&quot;)
<font color="#3A3966">      MenuItem</font>(0, &quot;New&quot;)
<font color="#3A3966">      MenuItem</font>(1, &quot;Open&quot;)
<font color="#3A3966">      MenuItem</font>(2, &quot;Save&quot;)
  <b><font color="#3A3966">EndIf</font></b>
  
<font color="#3A3966">  DisableToolBarButton</font>(0, 2, 1) <font color="#3A3966">; Disable the button '2'
</font>  
  <font color="#3A3966">;
</font>  <font color="#3A3966">; The event loop. A ToolBar event is like a Menu event (as tools are shortcut for menu the most
</font>  <font color="#3A3966">; of the time). This is handy, as if the ToolBar buttons and the MenuItem have the same ID, then
</font>  <font color="#3A3966">; the same operation can be done on both action without any adds..
</font>  <font color="#3A3966">;
</font>  
  <b><font color="#3A3966">Repeat</font></b>
    Event =<font color="#3A3966"> WaitWindowEvent</font>()

    <b><font color="#3A3966">Select</font></b> Event
    
      <b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event_Menu</font>
<font color="#3A3966">        MessageRequester</font>(&quot;Information&quot;, &quot;ToolBar or Menu ID: &quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">EventMenu</font>()), 0)
      
      <b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event_CloseWindow</font>  <font color="#3A3966">; If the user has pressed on the close button
</font>        Quit = 1
        
    <b><font color="#3A3966">EndSelect</font></b>

  <b><font color="#3A3966">Until</font></b> Quit = 1
  
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b>   <font color="#3A3966">; All resources are automatically freed
</font>   </font></pre>
</body></html>
